<?php

namespace App\Http\Controllers\Game\Other;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Http\Requests\Game\Other\Broadcast\ItemRequest;
use App\Http\Resources\Game\Other\Broadcast\DatasResource;
use App\Http\Resources\Game\Other\Broadcast\DataResource;
use App\Services\Game\Other\BroadcastService;

class BroadcastController extends Controller
{

    /**
     * 获取数据列表
     */
    public function getList(Request $request)
    {
        list ($collection, $total) = BroadcastService::make()->getList($request);

        return DatasResource::make($collection)->setPaginateTotal($total);
    }

    /**
     * 发布游戏公告
     */
    public function saveItem(ItemRequest $request)
    {
        $data = BroadcastService::make()->saveItem($request);

        return new DataResource($data);
    }
}
